Skip to content

feat: implement multi-line paste functionality with reference storage#37

Merged
cnjack merged 1 commit intomainfrom
feat/paste-with-multilines
Apr 24, 2026
Merged

feat: implement multi-line paste functionality with reference storage#37
cnjack merged 1 commit intomainfrom
feat/paste-with-multilines

Conversation

@cnjack
Copy link
Copy Markdown
Owner

@cnjack cnjack commented Apr 24, 2026

Summary by CodeRabbit

  • New Features

    • Multi-line pasted content is automatically collapsed into reference markers, keeping input cleaner while retaining full text
    • Textarea height now dynamically adapts to terminal dimensions
  • Improvements

    • Enhanced cursor navigation: up/down arrows prioritize moving within textarea content before switching history entries

@cnjack cnjack merged commit f3c3fa5 into main Apr 24, 2026
1 check was pending
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2f04d3d8-7dcc-48a1-a274-2cdd33ee0402

📥 Commits

Reviewing files that changed from the base of the PR and between 8759727 and f844b87.

📒 Files selected for processing (2)
  • internal/tui/paste_store.go
  • internal/tui/tui.go

📝 Walkthrough

Walkthrough

A new paste storage system introduces reference markers for multi-line clipboard content (3+ lines), storing full text internally while displaying compact references. This is integrated into the TUI layer alongside dynamic textarea height adjustment based on terminal dimensions.

Changes

Cohort / File(s) Summary
PasteStore Implementation
internal/tui/paste_store.go
New file introducing thread-safe paste storage with reference formatting. Stores content by ID, collapses 3+ line pastes into reference markers, normalizes line endings, counts lines, and expands references back to full content on demand.
TUI Integration & Textarea Sizing
internal/tui/tui.go
Integrates PasteStore into paste/clipboard handling, centralizes content storage and formatting through handlePasteContent, expands references on prompt submission, updates textarea height calculation to respect terminal bounds, and refines cursor navigation in textarea to prioritize vertical movement within the editor.

Sequence Diagram

sequenceDiagram
    participant User
    participant TUI
    participant PasteStore as Paste Store
    participant Display

    User->>TUI: Paste content (3+ lines)
    TUI->>PasteStore: StoreAndFormat(content)
    PasteStore->>PasteStore: Store content with ID
    PasteStore-->>TUI: Return reference marker
    TUI->>Display: Display reference
    
    User->>TUI: Submit prompt with reference
    TUI->>PasteStore: ExpandRefs(input)
    PasteStore-->>TUI: Return expanded content
    TUI->>Display: Process full content
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Paste grows long? We've got a plan—
Store it safe in our furry span!
References slim, content preserved,
Expand when needed, perfectly served! 📋✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/paste-with-multilines

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cnjack cnjack deleted the feat/paste-with-multilines branch April 24, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant